
var day = yesterday.getDate();
var mon = yesterday.getMonth() + 1;
var yr  = yesterday.getFullYear();

function checkDateFormat(date) {
    return (date.match("^[0-9]{1,2}\\. *[0-9]{1,2}\\. *[0-9]{4}$") != null);
}

function checkHourFormat(time) {
    return (time.match("^[0-9]{1,2}[ :.]??[0-9]{2}$") != null);
}

function getDateStr(d, m, y)
{
    if (10 > d)
        d = '0' + d;
    if (10 > m)
        m = '0' + m;
    return d + '.' + m + '.' + y;
}

function checkDate(d) {
    if (!checkDateFormat(d)) {
        alert(illegalDateFormatMsg);
        return false;
    }
    return true;
}

function checkHour(h) {
    if (!checkHourFormat(h)) {
        alert(illegalHourFormatMsg);
        return false;
    }
    return true;
}

function checkHours(f) {
    var ok = checkHour(f.fromTime.value);
    if (f.toTime)
        ok = ok && checkHour(f.tillTime.value);
    return ok;
}

function checkDates(f) {
    var ok = checkDate(f.fromDate.value);
    if (f.toDate)
        ok = ok && checkDate(f.tillDate.value);
    return ok;
}

function checkDatesAndHours(f) {
    return checkDates(f) && checkHours(f);
}
